package com.tjp.eight.ui.fragment.tabhome;

import android.util.Log;

import com.tjp.eight.base.BasePresenterImpl;
import com.tjp.eight.constant.UrlConstant;
import com.tjp.eight.net.NetCallBack;
import com.tjp.eight.net.SubscribeCallBack;


/**
 * Created by Administrator on 2017/2/13.
 */
public class HomePresenter extends BasePresenterImpl<HomeView> {
    private HomeService homeService = HomeNetWork.getRetrofit(UrlConstant.BaseUrl).create(HomeService.class);

    public HomePresenter(HomeView homeView) {
        attachView(homeView);
    }

    public void loadData() {
        addSubscription(homeService.getData(), new SubscribeCallBack<>(new NetCallBack<HomeModel>() {
            @Override
            public void onSuccess(HomeModel model) {
                view.loadData(model);
            }

            @Override
            public void onFails(int code, String msg) {
                view.loadFails(msg);
            }

            @Override
            public void onCompleted() {
                Log.e("s","Sss");
            }
        }));
    }
}
